<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
		<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
		<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
		<meta name="viewport" content="width=device-width; initial-scale=1.0" />

		
	</head>

	<body>
		<div data-role="page"  data-theme="b" id="page1">
			
			<header data-tap-toggle="false" data-position="fixed" data-role="header" role="banner">
				
				<a href="#menuPanel" data-role="button" data-icon="bars" data-iconpos="notext" data-theme="b" data-inline="true">Bars</a>
				
				<h1 id="centerheader">
					<a href="main.html">
						<!-- <img src="img/aa.png" alt="" /> -->
					</a>
				</h1>
				<h5>${sessionScope.userLoginInfo.name}님 환영합니다.</h5>
				<a href="#rightpanel" data-role="button" data-icon="grid" data-iconpos="notext" data-theme="b" data-inline="true">Grid</a>
				
			</header>
							
			
			
			<section id="menuPanel" data-display="overlay" data-position-fixed="true" data-role="panel"  data-theme="b">
			<div class="ui-panel-inner" ><nav class="main-nav">
				<ul class="menupanel_one">
					<li>
					<a href="main" data-lid="home" class="ui-link active">MAIN</a>
					</li>
					
					<li>
					<a data-lid="vehicles" class="ui-link">업무보고</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="reportingregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="todayreporting" data-lid="mobile_apps" class="ui-link">일일업무</a>
							</li>
							<li>
								<a href="weekreporting" data-lid="mobile_apps" class="ui-link">주간업무</a>
							</li>
							<li>
								<a href="monthreporting" data-lid="mobile_apps" class="ui-link">월간업무</a>
							</li>
						</ul>
					<li>
						
					<a data-lid="vehicles" class="ui-link">회의록</a>
					
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="minutesregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="minuteslist" data-lid="mobile_apps" class="ui-link">지난 회의록</a>
							</li>
						</ul>
				
					<li>
						<a data-lid="mobile_apps" class="ui-link">거래처 관리</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="accountlist" data-lid="mobile_apps" class="ui-link">거래처 보기</a>
							</li>
							<li>
								<a href="accountregist" data-lid="mobile_apps" class="ui-link">거래처 등록</a>
							</li>							
						</ul>
					
					<li>
						<a href="location" data-lid="owner_site" >팀원 위치 보기</a>
					</li>
					
					<li>
						<a href="#companybbs" data-lid="owner_site" >사내 게시판</a>
					</li>
						
					<li>
						<a data-lid="owner_site" >PT</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="ptregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="ptview" data-lid="mobile_apps" class="ui-link">보 기</a>
							</li>							
						</ul>
					
				</ul>
				</nav></div>
			</section>	
			
			
			
					
			<div data-role="panel" id="rightpanel" data-display="overlay" data-position="right" data-theme="b">
				
			</div>
			
			
			
	<div data-role="content" class="ui-panel-content-wrap">
 
			<header>
				<h1>상세글 보기</h1>
			</header>
			
			<form id="teamBbsViewForm" method="post">
							    
				    <ul data-role="listview" data-inset="true">   
				    	<li class="ui-body ui-body-b">  
				        <div data-role="fieldcontain" class="ui-hide-label">
				            <input type="text" id="title" value='${vo.title }'>
				      	</div>
				      	</li>  
				      	<li class="ui-body ui-body-b">  
				         <div data-role="fieldcontain" class="ui-hide-label">
				        	<textarea style="height:300px;" name="content" id="content">${vo.content }</textarea>
				        </div>
				    	    				        
				        </li> 			        
				        <li class="ui-body ui-body-b">
				            		<P>
				            		<a href="#replyPopup" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-icon="check" data-theme="a" data-transition="flip">리플</a>
				            		<a href="#page2" data-role="button" data-theme="b" data-inline="true">수정</a>
				                    <a href="/pork/teambbslist" data-role="button" data-theme="b" data-inline="true">목록</a>
				                    </P>
				        </li>
				    </ul>
				    <input type="hidden" id="departCode" value=${sessionScope.userLoginInfo.departCode} />
				    <input type="hidden" id="writer" value=${sessionScope.userLoginInfo.epid} />
				</form>	
						 	 
				<div class ="replyList">
					<div data-role="collapsible-set" data-theme="c" data-content-theme="d">				
								 
				    <div data-role="collapsible"><h2>리플</h2>
				        
				        <ul data-role="listview" data-theme="d" data-divider-theme="d">
				           
				           	<c:forEach items="${requestScope.replyList }" var="list">
				            <li data-role="list-divider">${list.replyer }<strong>&nbsp;<${list.regdate }></strong></li>
					            <li><a href="">
					                    <p><strong>${list.reply } </strong></p>
					            </a></li>
				            </c:forEach>
				            
				        </ul>
				    </div>
				    
					</div>
				 
					</div>
					
					
					
					<div data-role="popup" id="replyPopup" data-theme="b" class="ui-corner-all">
					    <form method="post">
					        <div style="padding:10px 20px;">
					            <h3>댓 글 쓰 기 </h3>
					            <div data-role="fieldcontain" class="ui-hide-label">
				        			<textarea style="width: 300px; height: 250px; " id="reply"></textarea>
				      			  </div>
					            
					            <a href="#" id="replyRegist" data-role="button" data-theme="b" data-icon=" check" data-inline="true">완료</a>
					            <!-- <button type="submit" data-theme="b" data-icon=" check" id="replyRegist">댓 글 등 록</button> -->
					        </div>
					    </form>
					</div>
						
		

	

			
	</div>
				
</div>

<!-- 글수정 페이지 2 -->
<div data-role="page" id="page2">
  <header data-tap-toggle="false" data-position="fixed" data-role="header" role="banner">
				
				<a href="#menuPanel" data-role="button" data-icon="bars" data-iconpos="notext" data-theme="b" data-inline="true">Bars</a>
				
				<h1 id="centerheader">
					<a href="main.html">
						<!-- <img src="img/aa.png" alt="" /> -->
					</a>
				</h1>
				<h5>${sessionScope.userLoginInfo.name}님 환영합니다.</h5>
				<a href="#rightpanel" data-role="button" data-icon="grid" data-iconpos="notext" data-theme="b" data-inline="true">Grid</a>
				
			</header>
							
			
			
			<section id="menuPanel" data-display="overlay" data-position-fixed="true" data-role="panel"  data-theme="b">
			<div class="ui-panel-inner" ><nav class="main-nav">
				<ul class="menupanel_one">
					<li>
					<a href="main" data-lid="home" class="ui-link active">MAIN</a>
					</li>
					
					<li>
					<a data-lid="vehicles" class="ui-link">업무보고</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="reportingregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="todayreporting" data-lid="mobile_apps" class="ui-link">일일업무</a>
							</li>
							<li>
								<a href="weekreporting" data-lid="mobile_apps" class="ui-link">주간업무</a>
							</li>
							<li>
								<a href="monthreporting" data-lid="mobile_apps" class="ui-link">월간업무</a>
							</li>
						</ul>
					<li>
						
					<a data-lid="vehicles" class="ui-link">회의록</a>
					
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="minutesregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="minuteslist" data-lid="mobile_apps" class="ui-link">지난 회의록</a>
							</li>
						</ul>
				
					<li>
						<a data-lid="mobile_apps" class="ui-link">거래처 관리</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="accountlist" data-lid="mobile_apps" class="ui-link">거래처 보기</a>
							</li>
							<li>
								<a href="accountregist" data-lid="mobile_apps" class="ui-link">거래처 등록</a>
							</li>							
						</ul>
					
					<li>
						<a href="location" data-lid="owner_site" >팀원 위치 보기</a>
					</li>
					
					<li>
						<a href="#companybbs" data-lid="owner_site" >사내 게시판</a>
					</li>
						
					<li>
						<a data-lid="owner_site" >PT</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="ptregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="ptview" data-lid="mobile_apps" class="ui-link">보 기</a>
							</li>							
						</ul>
					
				</ul>
				</nav>
			</div> <!-- 왼쪽메뉴 -->
			</section>	
			
			<div data-role="panel" id="rightpanel" data-display="overlay" data-position="right" data-theme="b"></div>
			
			<div data-role="content" class="ui-panel-content-wrap">
			
			<header>
				<h1>글 수정</h1>
			</header>
			
			<form id="teambbsupdate" method="post">
				    <ul data-role="listview" data-inset="true">
				        <li data-role="fieldcontain">
				            <label for="titleUpdate">제목 : </label>
				            <input type="text" id="titleUpdate" value="${vo.title }" data-clear-btn="true">
				        </li>
				        <li data-role="fieldcontain">
				            <label for="contentUpdate">내용 :</label>
				        <textarea style="height:300px;" id="contentUpdate" >${vo.content }</textarea>
				        </li>
				        <li data-role="fieldcontain">
				            <label for="noticeUpdate">팀 공지 :</label>
				            <select id="noticeUpdate" data-role="slider">
				                <option value="0">일반</option>
				                <option value="1">공지</option>
				            </select>
				        </li>
				        
				        <input type="hidden" id="seqno" value=${vo.seqno } />				        
				    	<input type="hidden" id="departCodeUpdate" value=${sessionScope.userLoginInfo.departCode} />
				    	<input type="hidden" id="writerUpdate" value=${sessionScope.userLoginInfo.epid} />    				        
				        				        
				        <li class="ui-body ui-body-b">
				            <fieldset class="ui-grid-a">
				                    <div class="ui-block-a"><a href="#page1" data-role="button" data-theme="a" >취소</a></div>
				                    <div class="ui-block-b" ><a href="#" data-role="button" data-theme="b" class="updateBtn">완료</a></div>
				            </fieldset>
				        </li>
				    </ul>
			</form>	
				
			<!-- <a href="#page1" data-role="button" data-inline="true">취소</a>
   			<input type="button" value="Which Page is this?" class="myButton" data-inline="true"/> <br>
    		<div class="myResult">The result will be displayed here</div> -->
			
 			</div>
			
</div>


<style>

body{
overflow: hidden;
}

#myResult {
    border: 1px solid;
    border-color: #108040;
    padding: 10px;
  }
</style>
			
<script>
	
//////////////////////////////////////////////////////////////////////////////


 $( '.updateBtn' ).on( "click", function() {
   
	  console.log("updateBtn");
	  console.log($('#seqno').val());
	  console.log($('#departCode').val());
	  
	 	$.post('teambbsupdate' , {"seqno" : $('#seqno').val() , "title" : $('#titleUpdate').val(), 
	 		"content" : $('#contentUpdate').val(), "departCode" :  $('#departCodeUpdate').val() , "writer" :  $('#writerUpdate').val()     }).done(function(data){
	 			location.href = "teambbsview?seqno="+$('#seqno').val()+"&writer="+$('#writer').val()+"&departCode="+$('#departCode').val()+""; 
		});  
});

 $( '#replyRegist' ).on( "click", function() {
	 
	 console.log("replyRegist")

	 	$.post('teamreplyregist' , {"bbsno" : $('#seqno').val() , "reply" : $('#reply').val() ,"replyer" : $('#writer').val()   }).done(function(data){
	 			location.href = "teambbsview?seqno="+$('#seqno').val()+"&writer="+$('#writer').val()+"&departCode="+$('#departCode').val()+""; 
		});  
	 	 
 }); 

</script>
</body>
</html>